#ifndef SINGLETON_H_INCLUDED
#define SINGLETON_H_INCLUDED

template <typename T>
class Singleton {
public:

    static T &getInstacne()
    {
        if (!m_instance)
            m_instance = new T;
        return *m_instance;
    }

    static void Destory()
    {
        if (m_instance) {
            delete m_instance;
            m_instance = NULL;
        }
    }

private:

    static T *m_instance;

};

#define INST(T) Singleton<T>::getInstacne()
#define INIT(T) template <> T *Singleton<T>::m_instance = NULL
#define DELE(T) Singleton<T>::Destory()

#endif // SINGLETON_H_INCLUDED
